//
//  GetHeightTools.m
//  UI13_自定义Cell的行高
//
//  Created by dllo on 16/6/22.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "GetHeightTools.h"

@implementation GetHeightTools


+(CGFloat)heightWithText:(NSString *)text
{
    NSDictionary *attributesDic = @{
                                    NSFontAttributeName:[UIFont systemFontOfSize:17]
                                    };
    
    CGRect rect = [text boundingRectWithSize:CGSizeMake([UIScreen mainScreen].bounds.size.width, 1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:attributesDic context:nil];
    
    
    /**返回计算出来的行的高度*/
    return rect.size.height;
    
}

+(CGFloat)imageHeightWith:(NSString *)imageName
{
    UIImage *image = [UIImage imageNamed:imageName];
    
    /**根据图片的宽高比例算出自适应高度*/
    
    CGFloat height = image.size.height * [UIScreen mainScreen].bounds.size.width / image.size.width;
    
    return height;
    

    
}








@end
